<?php 
	$this->load->view('header');
	$this->load->view('header_end');
	$this->load->view('modules/banner_menu_top');
?>
<div id="content">
	<div id="left_column">
		<?php 
			$this->load->view('modules/mod_menu_left');
			$this->load->view('modules/mod_info_left');
			$this->load->view('modules/mod_other_left');
		?>
	</div>
	<div id="main_column">
		<div id="page">
			<h4 class="title_page">Sản Phẩm Khuyến Mãi</h4>
			<div class="list_items">
				<?php  
					$data_list	= $data_list_sale;
					$count = 1;
					$num_colum = 4;	
					foreach($data_list as $data): 
				?>
				<?php if($count > 1 && $count%$num_colum == 1): ?>
				</div>
				<?php endif; ?>
				<?php if($count == 1 OR $count%$num_colum == 1 ): ?>
				<div class="items_row">
				<?php endif; ?>
					<?php if($count > 1 && $count%4==0): ?>
					<div class="items_mod last_list">
					<?php else: ?>
					<div class="items_mod">
					<?php endif; ?>
						<h4 class="title"><a href="<?php echo base_url().'product/detail/'.$data['nid'] ?>"><?php echo $data['cproducts'] ?></a></h4>
						<?php if($data['cimage_resize'] !=''): ?>
						<a href="<?php echo base_url().'product/detail/'.$data['nid'] ?>"><img src="<?php echo base_url().'upload/images_product/resize_images/'.$data['cimage_resize'] ?>" alt="<?php echo $data['cproducts'] ?>" width="170" height="135" class="img_fade"  id="slidingProduct<?php echo $data['nid'] ?>"/></a>
						<?php else: ?>
						<a href="<?php echo base_url().'product/detail/'.$data['nid'] ?>"><img src="<?php echo base_url().'images/noimage.jpg'; ?>" alt="<?php echo $data['cproducts'] ?>" width="170" height="135" class="img_fade"  id="slidingProduct<?php echo $data['nid'] ?>"/></a>
						<?php endif; ?>
						<p class="price">
							<?php 
								if($data['fprice_sale'] != 0 && $data['fprice_sale'] != '')
									echo show_price($data['fprice_sale']).show_price_sale($data['fprice']);
								else
									echo show_price($data['fprice']);
							?>
						</p>
						<p style="text-align:center;">
							<form id="frmProduct<?php echo $data['nid'] ?>" action="<?php echo base_url().'product/add_cart/'.$data['nid'] ?>" method="post">
							<?php if($data['fprice'] == 0 || $data['nid'] == ''){ ?>
								<a href="javascript: call_cart()" ><img src="<?php echo base_url().'images/btn_cart.png' ?>" alt="btn_cart" /></a>
							<?php } else { ?>
								<a href='javascript: add_cart(<?php echo $data['nid'] ?>)'>
									<img src="<?php echo base_url().'images/btn_cart.png' ?>" alt="btn_cart" />
								</a>
							<?php } ?>
							</form>
						</p>
					</div>			
				<?php if($count == count($data_list)): ?>
				</div>
				<?php endif; ?>
				<?php
					$count++;  
					endforeach; 
				?>
			</div>
			<div class="pagination">
			<?php
				if($get_page != '')
					echo $get_page; 
			?>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	function add_cart(nid)
	{	
		addToBasket(nid);
		setTimeout("submit3("+nid+")",1000);
	}
	function submit3(nid)
	{
		f_form	= "frmProduct"+nid;
		document.forms[f_form].submit();
	}
	function call_cart()
	{
		alert(' <?php 
			$obj_data = get_config_byid(7);
			if(count($obj_data)>0):
				foreach($obj_data as $data):
					echo $data['cnote'];
				endforeach;
			endif;
		 ?>
');
	}

</script>
<?php 
	$this->load->view('footer');
?>
